<link rel="stylesheet" href="{{ 'component-slider.css' | asset_url }}" media="print" onload="this.media='all'">
<link rel="stylesheet" href="{{ 'component-card.css' | asset_url }}" media="print" onload="this.media='all'">
<link rel="stylesheet" href="{{ 'component-article-card.css' | asset_url }}" media="print" onload="this.media='all'">
<link rel="stylesheet" href="{{ 'section-featured-blog.css' | asset_url }}" media="print" onload="this.media='all'">

<noscript>{{ 'component-slider.css' | asset_url | stylesheet_tag }}</noscript>
<noscript>{{ 'component-card.css' | asset_url | stylesheet_tag }}</noscript>
<noscript>{{ 'component-article-card.css' | asset_url | stylesheet_tag }}</noscript>

{{ 'section-featured-blog.css' | asset_url | stylesheet_tag }}
{%- liquid
  assign posts_displayed = section.settings.blog.articles_count
  if section.settings.post_limit <= section.settings.blog.articles_count
    assign posts_exceed_limit = true
    assign posts_displayed = section.settings.post_limit
  endif
-%}
<div class="recommend-blog first-blog  tenways-blog blog{% if section.settings.soft_background %} background-secondary{% endif %}{% if section.settings.heading == blank %} no-heading{% endif %}">
  <div class="page-width page-width-desktop{% if posts_displayed < 3 %} page-width-tablet{% endif %}">
    {% if section.settings.heading != blank %}
    <div class="title-wrapper-with-link{% if section.settings.heading == blank %} title-wrapper-with-link--no-heading{% endif %} {% if posts_displayed > 2 %}title-wrapper--self-padded-tablet-down{% else %}title-wrapper--self-padded-mobile{% endif %}">
      <h2 class="blog__title center">{{ section.settings.heading | escape }}</h2>

      {%- if section.settings.blog != blank and section.settings.show_view_all and section.settings.post_limit < section.settings.blog.articles_count -%}
        <a href="{{ section.settings.blog.url }}"
          class="link underlined-link large-up-hide"
        >
          {{ 'sections.featured_blog.view_all' | t }}
        </a>
      {%- endif -%}
    </div>
    {% endif %}
    {%- if section.settings.blog != blank and section.settings.blog.articles_count > 0 -%}
      <slider-component class="slider-mobile-gutter">
        <ul id="Slider-{{ section.id }}"
          class="blog__posts articles-wrapper grid grid--peek grid--2-col-tablet grid--4-col-desktop slider {% if posts_displayed > 2 %}slider--tablet{% else %}slider--mobile{% endif %}"
          role="list"
        >
           {% assign Darticle = article.title %}

        {%- for article in section.settings.blog.articles limit: 1 -%}

        {%- if Darticle == article.title -%}

     {% else %}
       
          <li class="blog__post grid__item article slider__slide slider__slide--full-width">
            {% render 'tenways-article-card', blog: section.settings.blog, article: article, show_image: section.settings.show_image, show_date: section.settings.show_date, show_author: section.settings.show_author %}
          </li>

          {%- endif -%}

        {%- endfor -%}
        </ul>
      </slider-component>

      {%- if section.settings.show_view_all and section.settings.post_limit < section.settings.blog.articles_count -%}
        <div class="blog__view-all center small-hide medium-hide">
          <a href="{{ section.settings.blog.url }}" class="blog__button button">
            {{ 'sections.featured_blog.view_all' | t }}
          </a>
        </div>
      {%- endif -%}
    {%- else -%}
      <div class="blog-placeholder">
        <div class="placeholder media media--landscape">
          {{ 'image' | placeholder_svg_tag: 'placeholder-svg' }}
        </div>
        <div class="blog-placeholder__content">
          <h2>
            {{ 'sections.featured_blog.onboarding_title' | t }}
          </h2>
          <p class="rte-width">
            {{ 'sections.featured_blog.onboarding_content' | t }}
          </p>
        </div>
      </div>
    {%- endif -%}
  </div>
</div>

{% schema %}
{
  "name": "t:sections.featured-blog.name",
  "tag": "section",
  "class": "spaced-section spaced-section--full-width",
  "settings": [
    {
      "type": "text",
      "id": "heading",
      "default": "Read more",
      "label": "t:sections.featured-blog.settings.heading.label"
    },
    {
      "type": "blog",
      "id": "blog",
      "label": "t:sections.featured-blog.settings.blog.label"
    },
    {
      "type": "range",
      "id": "post_limit",
      "min": 1,
      "max": 4,
      "step": 1,
      "default": 1,
      "label": "t:sections.featured-blog.settings.post_limit.label"
    },
    {
      "type": "checkbox",
      "id": "show_image",
      "default": true,
      "label": "t:sections.featured-blog.settings.show_image.label",
      "info": "t:sections.featured-blog.settings.show_image.info"
    },
    {
      "type": "checkbox",
      "id": "show_date",
      "default": true,
      "label": "t:sections.featured-blog.settings.show_date.label"
    },
    {
      "type": "checkbox",
      "id": "show_author",
      "default": false,
      "label": "t:sections.featured-blog.settings.show_author.label"
    },
    {
      "type": "checkbox",
      "id": "soft_background",
      "default": false,
      "label": "t:sections.featured-blog.settings.soft_background.label"
    },
    {
      "type": "checkbox",
      "id": "show_view_all",
      "default": false,
      "label": "t:sections.featured-blog.settings.show_view_all.label"
    }
  ],
  "presets": [
    {
      "name": "t:sections.featured-blog.presets.name",
      "settings": {
        "blog": "News"
      }
    }
  ]
}
{% endschema %}
